﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;

namespace DataAccess
{
    public class KeHoachDaoTao
    {
        int _Nhom;

        public int Nhom
        {
            get { return _Nhom; }
            set { _Nhom = value; }
        }
        string _MaMH;

        public string MaMH
        {
            get { return _MaMH; }
            set { _MaMH = value; }
        }
        int _Nam;

        public int Nam
        {
            get { return _Nam; }
            set { _Nam = value; }
        }
        private int _MaHK;

        public int MaHK
        {
            get { return _MaHK; }
            set { _MaHK = value; }
        }
        string _NamHoc;

        public string NamHoc
        {
            get { return _NamHoc; }
            set { _NamHoc = value; }
        }
        public static int KeHoachDaoTao_Them(int nhom, string mamh, int nam, int hk, string namhoc, int i)
        {
            try
            {
                using (SqlConnection conn = MyConnection.MyConn())
                {
                    SqlCommand cmd = conn.CreateCommand();
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "KeHoachDaoTao_Them";
                    cmd.Parameters.Add("@Nhom", SqlDbType.Int).Value = nhom;
                    cmd.Parameters.Add("@MaMH", SqlDbType.VarChar, 10).Value = mamh;
                    cmd.Parameters.Add("@Nam", SqlDbType.Int).Value = nam;
                    cmd.Parameters.Add("@MaHK", SqlDbType.Int).Value = hk;
                    cmd.Parameters.Add("@NamHoc", SqlDbType.VarChar, 9).Value = namhoc;
                    cmd.Parameters.Add("@Count", SqlDbType.Int).Value = i;

                    conn.Open();
                    int after = cmd.ExecuteNonQuery();
                    return after;
                }
            }
            catch
            {
                return -1;
            }

        }
    }
}
